package com.quanquan.store.repository;

import com.quanquan.store.entity.Concern;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @ClassName:ConcernRepository
 * @Description:TODO
 * @Author:xiongjunbao
 * @Date:2019/3/20 17:36
 * @Version 1.0
 */
public interface ConcernRepository extends JpaRepository<Concern,String> {

    @Query(value = "SELECT * FROM oo_concern WHERE user_id = ?1 AND status_show = 0 AND status_remove = ?4 ORDER BY update_time DESC LIMIT ?2,?3", nativeQuery = true)
    List<Concern> queryByUserId(String userId, Integer count, Integer size, Integer statusRemove);

    @Query(value = "SELECT * FROM oo_concern WHERE user_id = ?1 and store_id = ?2 AND status_show = 0", nativeQuery = true)
    Concern queryByUserIdAndStoreId(String userId, String storeId);

}
